home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / remote4.doc < prev    next >
Text File  |  1995-03-31  |  6KB  |  97 lines

  1. (Comp.sys.hp48) 
  2. Item: 438 by stevev@greylady.uoregon.edu 
  3. Author: [Steve VanDevender] 
  4.   Subj: REMOTE4: IR and IR2--IR remote-control sampling programs 
  5.   Date: Tue Dec 31 1991 
  6.  
  7. [Note: Also see REMOTE3 on this disk for another programmer's approach 
  8.  to turning the HP 48 into a universal infrared remote control.  -jkh-] 
  9.  
  10. These programs embody a new way of performing infrared remote control 
  11. sampling on the HP-48.  The previously distributed remote sampling 
  12. programs sampled IR input by continually reading the IR input and 
  13. immediately writing it out to memory.  These programs use a different 
  14. approach--they continually sample the IR input while incrementing a 
  15. timing count, and only write information to memory when the IR state 
  16. changes or the counter overflows.  This approach increases the 
  17. effective sampling rate under many circumstances and greatly reduces 
  18. the amount of memory needed to store samples.  I have also paid 
  19. special attention to instruction timing to make sure that the timing 
  20. characteristics of the sampling and playback routines are as nearly 
  21. identical as possible; this has been a problem with some previous 
  22. attempts at remote sampling. 
  23.  
  24. One of my motivations for writing these programs was that the other IR 
  25. samplers I tried wouldn't work at all with my VCR.  Both of these work 
  26. with my VCR, although I have obtained mixed results using these 
  27. programs with other kinds of remotes.  I am hoping that these programs 
  28. will be more effective than previous attempts, and that the techniques 
  29. I have used here can be improved upon by others. 
  30.  
  31. There are two separate IR sampling systems included here.  The first, 
  32. in the IR subdirectory, are the first programs I developed that 
  33. worked.  They store 3-nibble sample units--1 nibble for the current IR 
  34. input state, and 2 nibbles for a repeat count.  The inner loop of the 
  35. sampling and playback routines runs at about 25 microseconds per loop 
  36. iteration, and take about 40 microseconds to write out the sample data 
  37. and re-enter the inner loop.  These routines will make samples of 
  38. about 90 bytes that work with my VCR.  The second, in IR2, are 
  39. 2-nibble samples containing a 1-nibble repeat count.  The inner loop 
  40. of these routines runs at about 23 microseconds per iteration, but 
  41. sample string are a little over twice as long, at 224 bytes for 
  42. samples that work with my VCR. Interestingly enough, though, Lutz 
  43. Vieweg's RFP program will pack samples created by either set of 
  44. routines to about the same length of 60 bytes.  [Note: See RF on 
  45. Goodies Disk #5 in the PROGRAMR directory.  -jkh-] 
  46.  
  47. The directory IR contains the 3-nibble sampling routines, and the 
  48. directory IR2 contains the 2-nibble sampling routines.  IR contains 
  49. the user RPL programs SAMPLE and PLAYBACK and the machine code objects 
  50. IRSAMP and IRPLAY.  IR2 contains SAMPLE2, PLAYBACK2, IRSAMP2, and 
  51. IRPLAY2. 
  52.  
  53. The program SAMPLE (SAMPLE2) will take either a real number in level 
  54. 1, which is used to generate a string of that length to receive the 
  55. sample, or a string which will be overwritten with sample data. It 
  56. calls the machine-language program IRSAMP (IRSAMP2) which performs the 
  57. sampling.  IRSAMP checks for a string object in level 1, which must 
  58. have SIZE > 1, and aborts if it doesn't find one.  It then waits up to 
  59. 15 seconds for IR input, (that is, for you to place your remote 
  60. control next to the calculator and press the button for the remote 
  61. function you want to sample) and aborts if none is received in that 
  62. time. Otherwise it begins sampling and exits when the end of the 
  63. string in level 1 is reached.  I have found that holding an IR remote 
  64. too close to the calculator during sampling will often result in 
  65. ineffective samples; I get best results with the remote about 5-10 cm 
  66. from the IR input port. 
  67.  
  68. The program PLAYBACK (PLAYBACK2) will take a string in level 1 and 
  69. feed it to IRPLAY (IRPLAY2), then drop the string.  You can feed 
  70. strings directly to IRPLAY if you wish, but they will be left on the 
  71. stack (although this is a useful way to test samples without having to 
  72. recover them with LASTARG).  You should only feed strings created with 
  73. IRSAMP to PLAYBACK or IRPLAY.  It is possible to create strings which 
  74. leave the HP-48 IR LED on for long periods of time, which drains the 
  75. batteries and may cause hardware damage.  In any case, IRPLAY will 
  76. turn the IR LED off before exiting. 
  77.  
  78. Two of my friends who have tested these programs have reported that 
  79. they have experienced crashes while using them, although one report 
  80. did not appear to involve memory corruption or any other damage. 
  81. Therefore, I do not guarantee these programs to be bug-free--they may 
  82. cause crashes, memory corruption, or even hardware damage if used 
  83. improperly, although I can also say that I have had no problems for 
  84. over a week since I debugged the routines in the IR directory. 
  85. Neither are they guaranteed to work with any IR remote control, 
  86. although I suspect they will have greater success than previous remote 
  87. sampling programs. 
  88.  
  89. I would like to thank Dave Marsh for his original IR sampling 
  90. programs, which I have copied small parts of and which were my main 
  91. source of technical information in writing these programs, and Jan 
  92. Brittenson for his excellent STAR assembler and MLDL debugger which 
  93. made writing and debugging these programs easy. 
  94.  
  95. -- 
  96. Steve VanDevender   stevev@greylady.uoregon.edu 
  97.